<%% content_for :body_content_title do %>
  <%%= @<%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>.<%= title.name %><% else %>.title<% end %> %>
<%% end %>

<%% content_for :body do %>
<% attributes.each do |attribute| -%>
  <section>
    <h1><%= attribute.name.titleize %></h1>
    <p>
<% if attribute.refinery_type == :image -%>
      <%%= image_fu @<%= singular_name %>.<%= attribute.name.gsub('_id', '') %>, nil %>
<% elsif attribute.refinery_type == :resource -%>
      <%% if @<%= singular_name %>.<%= attribute.name %>.present? %>
        <%%= link_to <%= "'#{attribute.name}'" %>, @<%= singular_name %>.<%= attribute.name.gsub('_id', '') %>.url %>
      <%% else %>
        <%= attribute.name %>
      <%% end %>
<% else -%>
      <%%=raw @<%= singular_name %>.<%= attribute.name %> %>
<% end -%>
    </p>
  </section>
<% end -%>
<%% end %>

<%% content_for :side_body do %>
  <aside>
    <h2><%%= t('.other') %></h2>
    <ul id="<%= plural_name %>">
      <%% @<%= "all_" if plural_name == singular_name%><%= plural_name %>.each do |<%= singular_name %>| %>
        <li>
          <%%= link_to <%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>.<%= title.name %><% else %>.title<% end %>, refinery.<%= namespacing.underscore %>_<%= singular_name %>_path(<%= singular_name %>) %>
        </li>
      <%% end %>
    </ul>
  </aside>
<%% end %>

<%%= render '/refinery/content_page' %>
